package su.mvc.service;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;

import java.util.logging.Logger;

public class GoogleService {

    private static final Logger log = Logger.getLogger(GoogleService.class.getName());


    private UserService userService = UserServiceFactory.getUserService();
    
    private User getCurrentUser() {
        return userService.getCurrentUser();
    }
    

    public String getUserEmail() {
        return getCurrentUser().getEmail();
    }

    public String getUserId() {
        return getCurrentUser().getUserId();
    }

    public String getUserNickName() {
        return getCurrentUser().getNickname();
    }
    
    public String getLoginUri(String currentUri) {
        return userService.createLoginURL(currentUri);
    }

    public String getLogoutUri(String currentUri) {
        return userService.createLogoutURL(currentUri);
    }

    public boolean isUserLoggedIn() {
        return userService.isUserLoggedIn();
    }
    
}
